package com.dlyk.mapper;

import com.dlyk.bean.TActivity;
import com.dlyk.common.DataScope;
import com.dlyk.query.ActivityQuery;
import com.dlyk.query.BaseQuery;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface TActivityMapper {

    int deleteByPrimaryKey(Integer id);

    int insert(TActivity record);

    int insertSelective(TActivity record);

    TActivity selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TActivity record);

    int updateByPrimaryKey(TActivity record);

    /**
     * 活动分页查询
     * @param query
     * @return
     */
    @DataScope(tableAlias = "ta",tableFiled = "owner_id")
    List<TActivity> selectByActivityPage(ActivityQuery query);

    /**
     * 查询市场活动详情
     * @param id
     * @return
     */
    TActivity selectDetailByPrimaryKey(Integer id);

    /**
     * 查询正在进行的市场活动
     * @return
     */
    List<TActivity> getOnActivity();

    /**
     * 查询活动总数
     * @return
     */
    Integer selectActivityCount();
}